{% extends 'base.html' %}

{% block title %}注册{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h3 class="text-center">用户注册</h3>
            </div>
            <div class="card-body">
                <form method="post">
                    {% csrf_token %}
                    {% for field in form %}
                        <div class="mb-3">
                            {{ field.label_tag }}
                            {{ field }}
                            {% if field.errors %}
                                {% for error in field.errors %}
                                    <div class="text-danger">{{ error }}</div>
                                {% endfor %}
                            {% endif %}
                        </div>
                    {% endfor %}
                    <div class="d-grid">
                        <button type="submit" class="btn btn-primary">注册</button>
                    </div>
                </form>
                <div class="text-center mt-3">
                    已有账号？<a href="{% url 'login' %}">立即登录</a>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}